/*
 * @Description:
 * @Version: 1.0
 * @Autor: gaoluo
 * @Date: 2021-09-30 11:03:25
 * @LastEditors: gaoluo
 * @LastEditTime: 2021-10-14 15:55:25
 * @FilePath: /nhw/src/utils/uploadImages1.js
 */
import { uploadFile } from '@/api/work.js'
import axios from 'axios';

function mapId(res) {
  return res.map((item) => item.param.data.docNo)
}
export default async function (filelist) {
  const uploadProm = [];
  filelist.forEach((item) => {
    const formData = new FormData();
    formData.append('fileupload', item.file);
    formData.append('attachId', 'org.aweto.esm.equip.entity.EquipRepairsManage');
    formData.append('pkVal', '-1');
    uploadProm.push(uploadFile(formData));
    // console.log('uploadProm', uploadProm);
  });
  // console.log('arr');
  const res = await axios.all(uploadProm)

  return mapId(res)
}